package com.situ.day1;

import java.util.Scanner;

import org.junit.Test;

public class HomeWork {

	@Test
	public static void test1() {
		int num1 = 3;
		int num2 = 5;
		System.out.println("before num1: " + num1);
		System.out.println("before num2: " + num2);
		int temp = num1;
		num1 = num2;
		num2 = temp;
		System.out.println("after num1: " + num1);
		System.out.println("after num2: " + num2);
	}

	@Test
	public void test2() {
		Scanner scanner = new Scanner(System.in);
		System.out.println("请输入单价：");
		double dianJia = scanner.nextDouble();
		System.out.println("请输入数量：");
		double count = scanner.nextDouble();
		System.out.println("请输入用户金额：");
		double price = scanner.nextDouble();

		// 应收金额
		double totalPrice = dianJia * count;
		if (totalPrice >= 500) {
			// totalPrice = totalPrice * 0.8;
			totalPrice *= 0.8;
		}
		// 找零
		double zhaoLing = price - totalPrice;
		if (zhaoLing > 0) {
			System.out.println("应收金额：" + totalPrice);
			System.out.println("找零：" + zhaoLing);
		} else {
			System.out.println("付款金额不足");
		}
	}

	public static void main(String[] args) {
		System.out.println("请输入一个月份:");
		Scanner scanner = new Scanner(System.in);
		int month = scanner.nextInt();
		switch (month) {
		case 1:
		case 3:
		case 5:
		case 7:
		case 8:
		case 10:
		case 12:
			System.out.println("一月有31天哦");
			break;
		case 4:
		case 6:
		case 9:
		case 11:
			System.out.println("十一月有30天哦");
			break;
		case 2:
			System.out.println("请输入年份：");
			int year = scanner.nextInt();
			if ((year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0))) {
				System.out.println("是润年，所以今年二月有29天");
			} else {
				System.out.println("不是闰年，所以今年二月有28天");
			}
			break;
		default:
			System.out.println("没有这个月份哎");
			break;
		}
	}
	
	@Test
	public void test44() {
		Scanner scanner = new Scanner(System.in);
		System.out.println("请输入学生成绩:");
		int score = scanner.nextInt();
		if (score < 0 || score > 100) {
			System.out.println("输入成绩非法");
			return;
		}
		
		switch (score / 10) {
		case 9:
		case 10:
			System.out.println("优秀");
			break;
		case 8:
			System.out.println("良好");
			break;
		case 7:
			System.out.println("一般");
			break;
		case 6:
			System.err.println("及格");
			break;
		default:
			System.out.println("不及格");
			break;
		}
	}
	
	
	
	
	
	
	
	
	
	
	
	

}
